#include <bits/stdc++.h>

using namespace std;

struct node { node*	ch[10]; int	Sum; }U[110000],*root;

int	ALL; int	n;
char	a[11000][11];

void	INIT() { ALL=0; memset(U,0,sizeof(U)); root=U;ALL++; }

void	Insert(node*& t,const char* val)
{
	if(!t)t=U+(ALL++);
	t->Sum++;
	if(!*val)return ;
	Insert(t->ch[val[0]-48],val+1);
	return ;
}

int	Find(node*& t,const char* val)
{
	if(!*val)return t->Sum>1;
	if(!t)return false;
	return Find(t->ch[val[0]-48],val+1);
}

int main()
{
	int	T,i;

	scanf("%d",&T);
	while(T--)
	{
		INIT();
		scanf("%d",&n);
		for(i=1;i<=n;++i)
		{
			scanf("%s",a[i]);
			Insert(root,a[i]);
		}
		for(i=1;i<=n;++i) if(Find(root,a[i])){printf("NO\n");goto Fail;}
		printf("YES\n");
Fail:;
	}
	return 0;
}
